package com.yejiali.backend.config.ocr;

import com.aliyun.ocr_api20210707.Client;
import com.aliyun.teaopenapi.models.Config;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:yejiali
 * @Date:2025/5/28-05-28-8:45
 * @Decsription:com.yejiali.backend.config.ocr
 * @Version:1.0
 */
@Configuration
@Setter
@ConfigurationProperties(prefix = "aliyun")
public class AliyunOcrConfig {

    private String KeyId;
    private String KeySecret;
    private String Endpoint;

    @Bean
    public Client ocrClient(){
        try {
            Client client = new Client(new Config().setAccessKeyId(KeyId).setAccessKeySecret(KeySecret).setEndpoint(Endpoint));
            return client;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
